<?php
class Zendvn_View_Helper_CmsEditor extends Zend_View_Helper_Abstract{
	
	public function cmsEditor($name,$value=null,$options=null,$width='100%',$height='350'){
		//1. Nhung tap tin fckeditor.php
		require_once (SCRIPTS_PATH. "/fckeditor/fckeditor_php5.php") ;
		
		//2. Duong dan URL den thu muc fckeditor
		$sBasePath = SCRIPTS_URL. '/fckeditor/';
		
		//3. Khoi tao doi tuong fckeditor
		$oFCKeditor = new FCKeditor($name) ;
		
		//4.Thiet lap duong dan cho thuoc tinh BasePath
		$oFCKeditor->BasePath	= $sBasePath ;
		
		//5. Noi dung co san o fckeditor
		$oFCKeditor->Value		= $value;
		//Thay doi kick thuoc cua fckeditor
		$oFCKeditor->Width = $width;
		$oFCKeditor->Height= $height;
		
		if(!isset($options['toolbar'])){
			$oFCKeditor->ToolbarSet ='Default';
		}else{
			$oFCKeditor->ToolbarSet =$options['toolbar'];		
		}
		
		if(!isset($options['language'])){
			$oFCKeditor->Config['AutoDetectLanguage'] = false;
			$oFCKeditor->Config['DefaultLanguage'] 	  = 'en';
		}else{
			$oFCKeditor->Config['AutoDetectLanguage'] = false;
			$oFCKeditor->Config['DefaultLanguage'] 	  = $options['language'];
		}
		//6. Tao fckeditor
		return $oFCKeditor->Create() ;
	}
}